<template>
  <el-button slot="reference" @click="handleclick" :loading="loading" icon="el-icon-download">{{name}}</el-button>
</template>

<script>
import { scrollTo } from '@/utils/scroll-to'

export default {
  name: 'ExportList2ExcelwithMerges',
  data(){
      return{
         loading:false,
      }
  },
  props: {
      name:{
          type:String,
          default:"导出数据"
      }
  },
  computed: {
  },
  methods: {
    unlockLoading(){  //解锁按键
        this.loading = false
    },
    handleclick(){
        this.loading = true
        this.$emit('handleExport')
    },
    handleDownload(tableData) {
        let _this = this

        const {export_json_to_excel} = require('@/vendor/Export2Excel1')
        let result = this.formatJson(tableData.filterVal, tableData.list)
        export_json_to_excel(tableData.multiHeader, tableData.tHeader, result, tableData.filename, tableData.mergesRule)
        _this.unlockLoading()
      },
      formatJson(filterVal, jsonData) {
        return jsonData.map(v => filterVal.map(j => v[j]));
      },
}
}
</script>

<style scoped>
.pagination-container {
  background: #fff;
  /*padding: 32px 16px;*/
  margin-top: 10px !important;
}
.pagination-container.hidden {
  display: none;
}
</style>
